﻿// https://mp.weixin.qq.com/s?__biz=MzUxNjY5NTYxNA==&mid=2247489168&idx=2&sn=641154d0d86892a03430d3fa1d87d66d&scene=21#wechat_redirect
// https://leetcode-cn.com/problems/valid-anagram/

#include <iostream>
#include <vector>
#include <string>

using namespace std;

// struct ListNode {
//     int val;
//     ListNode *next;
//     ListNode() : val(0), next(nullptr) {}
//     ListNode(int x) : val(x), next(nullptr) {}
//     ListNode(int x, ListNode *next) : val(x), next(next) {}
// };

class Solution {
public:
    bool isAnagram(string s, string t) {
        int letter_s[26] = {0};
        int letter_t[26] = {0};

        if (s.size() != t.size())
            return false;

        for (int i = 0; i < s.size(); i++) {
            letter_s[s[i] - 97]++;
            letter_t[t[i] - 97]++;
        }

        for (int i = 0; i < 26; i++) {
            if (letter_s[i] != letter_t[i])
                return false;
        }

        return true;
    }
};

int main() {
    Solution obj = Solution();
    string s = "ab";
    string t = "a";
    cout << int('a') << endl;
}